home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / lampdq / lampdq.exc < prev    next >
Text File  |  1992-06-10  |  8KB  |  233 lines

  1. /* Pseudo-PDQ Interface Screen for OS/2 Extended Edition.       */
  2. /* Accepts requests for file transfer, handles CP messages, and */
  3. /* processes VM commands (sent as file transfer requests).      */
  4.  
  5. /* Larry Margolis, MARGOLI at YORKTOWN.  IBM Internal Use Only. */
  6.  
  7. if arg(1)='?' then do
  8.    say 'LAMPDQ is a pseudo-PDQ interface for use with OS/2 EE before the'
  9.    say 'ECF component is available.  See LAMPDQ NEWS on PCTOOLS for details.'
  10.    exit 100
  11. end
  12.  
  13. cmd='Command'; set='Command set'; res=set 'reserved'; nl='15'x
  14. parse source . . myname ft fm .
  15.  
  16. parse value qdisk('?') with . . . . . . bigdisk .
  17. if bigdisk='' then do; say 'You have no read/write disk space.'; exit 4; end
  18.  
  19. trace -1; address 'XEDIT' set 'SCREEN 1'
  20. if rc=-3 then do              /* XEDIT not active */
  21.    push myname 'QUIT'
  22.    Address '' 'XEDIT' myname ft fm '(NOPROF NOMSG'
  23.    exit rc
  24. end
  25.  
  26. address 'XEDIT'
  27. parse value diag(8,'QUERY SET') with ,
  28.                    'MSG ' msgset ',' 'WNG ' wngset ',' ,
  29.                    'EMSG ' emsgset ',' 'IMSG ' imsgset ',' ,
  30.                    'VMCONIO ' vmcset ',' 'CPCONIO ' cpcset . ','
  31. parse value cpcset with cpcset . '15'x  /* Maybe necessary for non-Ykt */
  32. call initialize
  33. call cpset
  34. call init_screen
  35. cmd 'Preserve'
  36. set 'BRKKEY OFF'        /* Trap PA1, also. */
  37. address '' 'IDENTIFY (LIFO'
  38. if rc=0 then pull . . node .
  39. set 'msgmode on long'
  40. set 'msgline on 1' lscreen.5 'overlay'
  41. if left(node,3)='YKT' then do
  42.    'QUERY CMSLEVEL (LIFO'
  43.    if rc = 0 then do
  44.       pull cms .
  45.       if CMS <> 'VM/XA' then
  46.          set 'CPMSG OFF'      /* Don't ask XEDIT to trap CP messages. */
  47.    end
  48. end
  49.  
  50. lastcmd=''
  51. call pulliucv
  52. Do forever
  53.    cmdline=''
  54.    key='?'
  55.    address '' 'DESBUF'
  56.    cmd 'Read Cmdline tag'
  57.    Do queued()
  58.       parse pull tag rest
  59.       if tag='CMD' then cmdline=rest
  60.       else do
  61.          if tag='PFK' | tag='PAK' then key=tag || subword(rest,1,1)
  62.          else key=tag
  63.       end
  64.    end
  65.    call pulliucv
  66.    if key='PFK3' | key='PFK15' then leave
  67.    if key='PAK1' then do         /* CP mode, but restore CP settings first. */
  68.       call cprestore
  69.       Address '' 'CP'
  70.       call cpset
  71.       iterate
  72.    end
  73.    if cmdline<>'' then do
  74.       if cmdline='?' then do; cmd 'CMSG' lastcmd; iterate; end
  75. /*  Uncomment the following line for a trace of commands executed.  */
  76. /*    Address '' 'EXECIO 1 DISKW LAMPDQ TRACE A (VAR CMDLINE FINIS' */
  77.       parse var cmdline cmdname verb fn ft fm '(' opts
  78.       if cmdname='IND$FILE' then do  /* Special handling */
  79.          if verb fn ft = 'GET HOSTCMD' then do
  80.             ft='CMSUT1'; fm=bigdisk
  81.             call docmd opts, fn ft
  82.             opts='ASCII CRLF'
  83.          end
  84.          else if verb fn ft = 'GET MSGS' then do
  85.             ft='CMSUT1'; fm=bigdisk
  86.             call domsgs fn ft
  87.             opts='ASCII CRLF'
  88.          end
  89.          Address '' 'IND$FILE' verb fn ft fm '(' opts
  90.          conio=0
  91.          call pulliucv 'CMD'
  92.          iterate
  93.       end
  94.       if cmdname='LAMPDQ' then do  /* Special handling; used by CP78 */
  95.          if verb='HOSTCMD' then do
  96.             parse var cmdline . . hostcmd
  97.             call docmd hostcmd, 'HOSTCMD CMSUT1'
  98.          end
  99.          else if verb='MSGS' then call domsgs 'MSGS CMSUT1'
  100.          iterate
  101.       end
  102.       call cprestore
  103.       trace -1
  104.       'CMS' cmdline
  105.       call cpset
  106.       lastcmd=cmdline
  107.    end
  108.    else if key='ETK' then do /* Enter key pressed; no command entered: */
  109.       do i=1 to msgs         /* display any messages received.         */
  110.          cmd "msg" msgs.i
  111.       end
  112.       msgs=0
  113.    end
  114. end
  115. Address '' "WAKEUP ( RESEXT QUIET"
  116. Address '' "WAKEUP RESET ( QUIET"
  117. call cprestore
  118. Do i=1 to lscreen.5-2
  119.    res i 'OFF'
  120. End
  121. Do i=1 to msgs
  122.    cmd "msg" msgs.i
  123. end
  124. cmd 'Restore'
  125. if arg(1)='QUIT' then 'QUIT'
  126. exit
  127.  
  128. initialize:  Address ''
  129.    /**
  130.     ** initial WAKEUP processing
  131.     **/
  132.    issubset = cmsflag('SUBSET')
  133.    "NUCEXT WAKEUP"
  134.    if rc ^= 0 then
  135.      if issubset then "NUCXLOAD WAKEUP ( SYSTEM SERVICE"
  136.      else "WAKEUP ( QUIET"
  137.    "WAKEUP (NOEXT QUIET"
  138.    "WAKEUP VERSION (QUIET"
  139.    if rc = 201 then do               /* too old for us */
  140.       wkrc = rc
  141.       "WAKEUP (RESEXT QUIET"
  142.       'SET CMSTYPE RT'
  143.       say ' Your copy of WAKEUP MODULE is out of date and unusable'
  144.       say ' with' myname'.  Obtain WAKEUP version 5.4.1 from VMTOOLS'
  145.       say ' (master disk at YKTVMZ).'
  146.       if arg(1)='QUIT' then address 'XEDIT' 'QUIT'
  147.       exit
  148.      end
  149.    msgs=0
  150.    return
  151.  
  152. docmd:  procedure expose conio conio. msgs msgs. bigdisk
  153.    parse arg cmd , fn ft .
  154.    trace -1
  155.    Address 'CMS' cmd                       /* Execute command */
  156.    conio=1; conio.1=rc
  157.    call pulliucv 'CMD'
  158.    Address '' 'EXECIO' conio 'DISKW' fn ft bigdisk'3 1 (STEM CONIO. FINIS'
  159.    drop conio.
  160.    return
  161.  
  162. domsgs:  procedure expose msgs msgs. bigdisk
  163.    parse arg fn ft .
  164.    if msgs=0 then do; msgs=1; msgs.1=' '; end
  165.    Address '' 'EXECIO' msgs 'DISKW' fn ft bigdisk'3 1 (STEM MSGS. FINIS'
  166.    drop msgs.; msgs=0
  167.    return
  168.  
  169. init_screen:
  170. cmd 'extract /lscreen/'
  171. Do i=1 to 5
  172.    res i 'nohigh'
  173. End
  174. res ' 6 nohigh                  LL                 AAAAAAAAAAAA      MMMM         MMM'
  175. res ' 7 nohigh                 LL                AA           AA    MM MM      MM MM'
  176. res ' 8 nohigh                LL                AA            AA   MM  MM    MM  MM'
  177. res ' 9 nohigh               LL                AA            AA   MM   MM  MM   MM'
  178. res '10 nohigh              LL                AAAAAAAAAAAAAAAA   MM    MMMM    MM'
  179. res '11 nohigh             LL   Lawrence     AA            AA   MM     MM     MM'
  180. res '12 nohigh            LL                AA    Alan    AA   MM            MM'
  181. res '13 nohigh           LL                AA            AA   MM  Margolis  MM'
  182. res '14 nohigh          LLLLLLLLLLLLL     AA            AA   MM            MM'
  183. res '15 nohigh'; res '16 nohigh'
  184. res '17 high                LaMail Interface Screen for OS/2 Extended Edition'
  185. res '18 nohigh'
  186. res '19 high                        IBM Internal Use Only  (Rel 0.3)'
  187. Do i=20 to lscreen.5-3
  188.    res i 'nohigh'
  189. End
  190. res lscreen.5-2 'high       Enter VM commands below, or press F3 to terminate LaMail interface.'
  191.    return
  192.  
  193. /*  *IUCV   - Unknown IUCV message type
  194.     *MSG    - CP MSG or MSGNOH command
  195.     *WNG    - CP WNG command
  196.     *EMSG   - SET EMSG IUCV
  197.     *IMSG   - SET IMSG IUCV
  198.     *SMSG   - SET SMSG IUCV
  199.     *CP     - SET CPCONIO IUCV
  200.     *VM     - SET VMCONIO IUCV
  201.     *SCIF   - SET SCIF IUCV
  202. */
  203. pullIUCV:  parse arg flag
  204.    do forever
  205.       Address '' 'WAKEUP +00:00:00 (IUCVMSG QUIET'
  206.       If rc = 2 then
  207.          if queued()=0 then leave
  208.          else do; parse pull line; type='QUEUED'; end
  209.       else Parse pull type uid line
  210.       If type='*MSG' | type='*WNG' | type='*SMSG' | flag<>'CMD' then do
  211.          msgs=msgs+1
  212.          if type='*MSG' | type='*WNG' | type='*SMSG' then
  213.             msgs.msgs='From' uid':' line
  214.          else        /* Asynchronous CP output; e.g., PUN FILE FROM...*/
  215.             msgs.msgs=line
  216.       end
  217.       else do
  218.          conio=conio+1
  219.          conio.conio=line
  220.       end
  221.    end
  222.    return
  223.  
  224. cpset:
  225. call diag 8,'SET MSG IUCV'nl'SET WNG IUCV'nl'SET EMSG IUCV'nl ,
  226.             'SET IMSG IUCV'nl'SET VMCONIO IUCV'nl'SET CPCONIO IUCV',1
  227. return
  228.  
  229. cprestore:
  230. call diag 8,'SET MSG' msgset nl'SET WNG' wngset nl'SET EMSG' emsgset nl ,
  231.       'SET IMSG' imsgset nl'SET VMCONIO' vmcset nl'SET CPCONIO' cpcset, 1
  232. return
  233.